
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace Showroom.DAL
{
	public abstract class _Users : SqlClientEntity
	{
		public _Users()
		{
			this.QuerySource = "Users";
			this.MappingName = "Users";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_UsersLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int ID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ID, ID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_UsersLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ID
			{
				get
				{
					return new SqlParameter("@ID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter UserName
			{
				get
				{
					return new SqlParameter("@UserName", SqlDbType.VarChar, 100);
				}
			}
			
			public static SqlParameter FullName
			{
				get
				{
					return new SqlParameter("@FullName", SqlDbType.NVarChar, 200);
				}
			}
			
			public static SqlParameter Password
			{
				get
				{
					return new SqlParameter("@Password", SqlDbType.VarChar, 100);
				}
			}
			
			public static SqlParameter MasterAdmin
			{
				get
				{
					return new SqlParameter("@MasterAdmin", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Deleted
			{
				get
				{
					return new SqlParameter("@Deleted", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter Address
			{
				get
				{
					return new SqlParameter("@Address", SqlDbType.NVarChar, 500);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ID = "ID";
            public const string UserName = "UserName";
            public const string FullName = "FullName";
            public const string Password = "Password";
            public const string MasterAdmin = "MasterAdmin";
            public const string Deleted = "Deleted";
            public const string Address = "Address";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _Users.PropertyNames.ID;
					ht[UserName] = _Users.PropertyNames.UserName;
					ht[FullName] = _Users.PropertyNames.FullName;
					ht[Password] = _Users.PropertyNames.Password;
					ht[MasterAdmin] = _Users.PropertyNames.MasterAdmin;
					ht[Deleted] = _Users.PropertyNames.Deleted;
					ht[Address] = _Users.PropertyNames.Address;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ID = "ID";
            public const string UserName = "UserName";
            public const string FullName = "FullName";
            public const string Password = "Password";
            public const string MasterAdmin = "MasterAdmin";
            public const string Deleted = "Deleted";
            public const string Address = "Address";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _Users.ColumnNames.ID;
					ht[UserName] = _Users.ColumnNames.UserName;
					ht[FullName] = _Users.ColumnNames.FullName;
					ht[Password] = _Users.ColumnNames.Password;
					ht[MasterAdmin] = _Users.ColumnNames.MasterAdmin;
					ht[Deleted] = _Users.ColumnNames.Deleted;
					ht[Address] = _Users.ColumnNames.Address;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ID = "s_ID";
            public const string UserName = "s_UserName";
            public const string FullName = "s_FullName";
            public const string Password = "s_Password";
            public const string MasterAdmin = "s_MasterAdmin";
            public const string Deleted = "s_Deleted";
            public const string Address = "s_Address";

		}
		#endregion		
		
		#region Properties
	
		public virtual int ID
	    {
			get
	        {
				return base.Getint(ColumnNames.ID);
			}
			set
	        {
				base.Setint(ColumnNames.ID, value);
			}
		}

		public virtual string UserName
	    {
			get
	        {
				return base.Getstring(ColumnNames.UserName);
			}
			set
	        {
				base.Setstring(ColumnNames.UserName, value);
			}
		}

		public virtual string FullName
	    {
			get
	        {
				return base.Getstring(ColumnNames.FullName);
			}
			set
	        {
				base.Setstring(ColumnNames.FullName, value);
			}
		}

		public virtual string Password
	    {
			get
	        {
				return base.Getstring(ColumnNames.Password);
			}
			set
	        {
				base.Setstring(ColumnNames.Password, value);
			}
		}

		public virtual bool MasterAdmin
	    {
			get
	        {
				return base.Getbool(ColumnNames.MasterAdmin);
			}
			set
	        {
				base.Setbool(ColumnNames.MasterAdmin, value);
			}
		}

		public virtual bool Deleted
	    {
			get
	        {
				return base.Getbool(ColumnNames.Deleted);
			}
			set
	        {
				base.Setbool(ColumnNames.Deleted, value);
			}
		}

		public virtual string Address
	    {
			get
	        {
				return base.Getstring(ColumnNames.Address);
			}
			set
	        {
				base.Setstring(ColumnNames.Address, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ID) ? string.Empty : base.GetintAsString(ColumnNames.ID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ID);
				else
					this.ID = base.SetintAsString(ColumnNames.ID, value);
			}
		}

		public virtual string s_UserName
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.UserName) ? string.Empty : base.GetstringAsString(ColumnNames.UserName);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.UserName);
				else
					this.UserName = base.SetstringAsString(ColumnNames.UserName, value);
			}
		}

		public virtual string s_FullName
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.FullName) ? string.Empty : base.GetstringAsString(ColumnNames.FullName);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.FullName);
				else
					this.FullName = base.SetstringAsString(ColumnNames.FullName, value);
			}
		}

		public virtual string s_Password
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Password) ? string.Empty : base.GetstringAsString(ColumnNames.Password);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Password);
				else
					this.Password = base.SetstringAsString(ColumnNames.Password, value);
			}
		}

		public virtual string s_MasterAdmin
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.MasterAdmin) ? string.Empty : base.GetboolAsString(ColumnNames.MasterAdmin);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.MasterAdmin);
				else
					this.MasterAdmin = base.SetboolAsString(ColumnNames.MasterAdmin, value);
			}
		}

		public virtual string s_Deleted
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Deleted) ? string.Empty : base.GetboolAsString(ColumnNames.Deleted);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Deleted);
				else
					this.Deleted = base.SetboolAsString(ColumnNames.Deleted, value);
			}
		}

		public virtual string s_Address
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Address) ? string.Empty : base.GetstringAsString(ColumnNames.Address);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Address);
				else
					this.Address = base.SetstringAsString(ColumnNames.Address, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter UserName
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.UserName, Parameters.UserName);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter FullName
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.FullName, Parameters.FullName);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Password
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Password, Parameters.Password);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter MasterAdmin
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.MasterAdmin, Parameters.MasterAdmin);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Deleted
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Address
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Address, Parameters.Address);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public WhereParameter UserName
		    {
				get
		        {
					if(_UserName_W == null)
	        	    {
						_UserName_W = TearOff.UserName;
					}
					return _UserName_W;
				}
			}

			public WhereParameter FullName
		    {
				get
		        {
					if(_FullName_W == null)
	        	    {
						_FullName_W = TearOff.FullName;
					}
					return _FullName_W;
				}
			}

			public WhereParameter Password
		    {
				get
		        {
					if(_Password_W == null)
	        	    {
						_Password_W = TearOff.Password;
					}
					return _Password_W;
				}
			}

			public WhereParameter MasterAdmin
		    {
				get
		        {
					if(_MasterAdmin_W == null)
	        	    {
						_MasterAdmin_W = TearOff.MasterAdmin;
					}
					return _MasterAdmin_W;
				}
			}

			public WhereParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public WhereParameter Address
		    {
				get
		        {
					if(_Address_W == null)
	        	    {
						_Address_W = TearOff.Address;
					}
					return _Address_W;
				}
			}

			private WhereParameter _ID_W = null;
			private WhereParameter _UserName_W = null;
			private WhereParameter _FullName_W = null;
			private WhereParameter _Password_W = null;
			private WhereParameter _MasterAdmin_W = null;
			private WhereParameter _Deleted_W = null;
			private WhereParameter _Address_W = null;

			public void WhereClauseReset()
			{
				_ID_W = null;
				_UserName_W = null;
				_FullName_W = null;
				_Password_W = null;
				_MasterAdmin_W = null;
				_Deleted_W = null;
				_Address_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter UserName
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.UserName, Parameters.UserName);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter FullName
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.FullName, Parameters.FullName);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Password
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Password, Parameters.Password);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter MasterAdmin
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.MasterAdmin, Parameters.MasterAdmin);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Deleted
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Address
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Address, Parameters.Address);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public AggregateParameter UserName
		    {
				get
		        {
					if(_UserName_W == null)
	        	    {
						_UserName_W = TearOff.UserName;
					}
					return _UserName_W;
				}
			}

			public AggregateParameter FullName
		    {
				get
		        {
					if(_FullName_W == null)
	        	    {
						_FullName_W = TearOff.FullName;
					}
					return _FullName_W;
				}
			}

			public AggregateParameter Password
		    {
				get
		        {
					if(_Password_W == null)
	        	    {
						_Password_W = TearOff.Password;
					}
					return _Password_W;
				}
			}

			public AggregateParameter MasterAdmin
		    {
				get
		        {
					if(_MasterAdmin_W == null)
	        	    {
						_MasterAdmin_W = TearOff.MasterAdmin;
					}
					return _MasterAdmin_W;
				}
			}

			public AggregateParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public AggregateParameter Address
		    {
				get
		        {
					if(_Address_W == null)
	        	    {
						_Address_W = TearOff.Address;
					}
					return _Address_W;
				}
			}

			private AggregateParameter _ID_W = null;
			private AggregateParameter _UserName_W = null;
			private AggregateParameter _FullName_W = null;
			private AggregateParameter _Password_W = null;
			private AggregateParameter _MasterAdmin_W = null;
			private AggregateParameter _Deleted_W = null;
			private AggregateParameter _Address_W = null;

			public void AggregateClauseReset()
			{
				_ID_W = null;
				_UserName_W = null;
				_FullName_W = null;
				_Password_W = null;
				_MasterAdmin_W = null;
				_Deleted_W = null;
				_Address_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_UsersInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.ID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_UsersUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_UsersDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.UserName);
			p.SourceColumn = ColumnNames.UserName;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.FullName);
			p.SourceColumn = ColumnNames.FullName;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Password);
			p.SourceColumn = ColumnNames.Password;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.MasterAdmin);
			p.SourceColumn = ColumnNames.MasterAdmin;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Deleted);
			p.SourceColumn = ColumnNames.Deleted;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Address);
			p.SourceColumn = ColumnNames.Address;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
